<? 
		if(isset($_POST['btnsubmit']))
		{
			require("required/dbconnect.php"); 
			
			$content=$_POST['content'];
			$title=mysql_escape_string($_POST['title']);
			$cat_id=$_POST['cat_id'];
			$order_id=$_POST['order_id'];
			
			$insert=mysql_query("insert into os_custserv_content(cat_id,content,title,order_id)value($cat_id,'$content','$title',$order_id)")or die(mysql_error());
			header("Location:custserv.php");
		
		}
		else
		{
				 
				if(empty($_GET['id']))
				{
					require("required/dbconnect.php");
					header("Location:os_invalid.php");
				}
				
				require("required/dbconnect.php"); 
				require("required/function.php");
				require("required/header.php"); 
				$id=$_GET['id'];
				$get_cat=mysql_query("select * from os_custserv_cat where id=$id");
				
				
				
				
				
				
				
?>
				
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				<script language="JavaScript">
					function validatefrm(frm1){
						if(document.frm1.title.value=="")
						{
							alert("Please enter title");
							document.frm1.title.focus();
							return false;
						}
						return true;
					}
				</script>		
					
					<td class="solidborder" width="84%" align="left" valign="top">
					
						<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm1" method="post" onSubmit="return validatefrm(this)">
						<table width="100%">
						
						<td class="title" colspan="3">
						<strong>Add content for "<?= mysql_result($get_cat,0,"cat_name") ?>"</strong>
						
						
						
						</td>
						
						<input type="hidden" value="<?= $id ?>" name="cat_id">
						<tr valign="top">
							<td colspan="4"><hr>
							
							</td>
						</tr>
						
						
						<tr>
							<td>Title</td><td>:</td><td><input class="text" type="text" name="title" size="30" value="" maxlength="200"></td>
						</tr>
						<tr>
							<td>Order ID</td><td>:</td><td><input class="text" type="text" name="order_id" size="2" value="" maxlength="2"></td>
						</tr>
						
						<tr valign="top">
							<td width="15%">Content </td><td width="3%">:</td>
							<td width="82%" valign="top">
								<? include_once("fckeditor/fckeditor.php") ?>
							<?php
								$oFCKeditor = new FCKeditor('content') ;
								$oFCKeditor->ToolbarSet = 'DeswinBasic';
								$oFCKeditor->BasePath = './fckeditor/' ;
								$oFCKeditor->Value = "" ;
								$oFCKeditor->Create() ;
							?>
							</td>
						</tr>
							
						
						<tr>
							<td colspan="2"><input type="submit" value="Submit" name="btnsubmit"></td>
						</tr>
						</table>
						</form>
					</td>
				 
				</table>
<? }require("required/footer.php"); ?>